<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateFileTempTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('file_upload_temp', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->char('hash', 32)->default('')->nullable(false)->unique('hash');
            $table->string('path',255)->comment('文件地址')->nullable(false)->default('');
            $table->string('created_by', 32)->comment('创建人')->nullable(false)->default('');
            $table->string('created_id', 32)->comment('创建人id')->nullable(false)->default(0);
            $table->string('class', 32)->comment('班级')->default(0);
            $table->char('status',9)->comment('文件状态;temp:临时文件,in_use:使用中,deleted:已删除')->default('');
            $table->string('file_name', 255)->comment('文件名')->default('');
            $table->string('suffix', 32)->comment('文件后缀')->default('')->default('');
            $table->integer('size')->comment('文件大小，单位kb')->default(0)->nullable(false);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('file_temp');
    }
}
